import service from "@/utils/http"

/* 获取文章详情 */
export const getArticleDetail = (articleId:number) => {
    return service({
        method:"GET",
        url:`/article/${articleId}`
    })
}

/* 获取文章的上下文 */
export const getArticleContext = (articleId:number) => {
    return service({
        method:"GET",
        url:`/article/context?articleId=${articleId}`
    })
}

/* 热门文章 */
export const getHotArticle = (count?:number) => {
    return service({
        method:"GET",
        url:count ? `/article/hostList?count=${count}` : `/article/hostList`
    })
}

// 更新当前文章的阅读数量
export const updateArticleViewsCount = (articleId:number) => {
    return service({
        method:"PUT",
        url:`/article/updateViews/${articleId}`
    })
}

//  文章点赞函数
export const updateArticleLikeCount = (articleId:number) => {
    return service({
        method:"PUT",
        url:`/article/updateLikes/${articleId}`
    })
}